package com.zdxlz.fcmp.common.mybatis.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description：设备信息表【设备类别】枚举类
 * @Author： aman
 * @Date： 2025/2/8 10:39
 */
@Getter
@AllArgsConstructor
public enum DeviceTypeEnum {
    DT_PONAP(31, "PONAP"),
    DT_GPON(32, "GPON"),
    DT_EPON(34, "EPON"),
    // 【DT_FTTR】为默认值
    DT_FTTR(38, "FTTR"),
    ;
    @EnumValue
    private final Integer code;
    private final String name;

    public static DeviceTypeEnum getByCode(Integer code) {
        for (DeviceTypeEnum deviceTypeEnum : DeviceTypeEnum.values()) {
            if (deviceTypeEnum.getCode() == code) {
                return deviceTypeEnum;
            }
        }
        return null;
    }

    @JsonValue
    public int getCode() {
        return code;
    }
}
